﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
using ePlanet.Entities;
using System.Drawing;
using Aspose.Cells;

namespace FilesUpload
{
    public class ExcelFileProcess
    {
        public bool SingleWellProcess1(string excelFilePath, out List<SingleWellEntity> returnSingleWells, out Dictionary<string, string> returnEntityRelateAttachFilePathDict)
        {
            try
            {
                Dictionary<string, string> dict = new Dictionary<string, string>();
                Dictionary<string, string> entityRelateAttachFilePathDict = new Dictionary<string, string>();
                List<SingleWellEntity> singleWells = new List<SingleWellEntity>();
                bool isTemplateError = false;
                bool isFinishReadCell = false;

                Workbook workbook = new Workbook();
                workbook.Open(excelFilePath);
                Cells cells = workbook.Worksheets[0].Cells;
                cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, cells.End.Column);
                Cell cell = null;

                int rowIndex = 1;
                string id = "";
                string sid = "";

                cell = cells[rowIndex, 0];
                if (cell.Value == null)
                {
                    isFinishReadCell = true;
                }
                else
                {
                    try
                    {
                        id = cell.IntValue.ToString();
                    }
                    catch (Exception)
                    {
                        id = cell.StringValue;
                        cell.Style.ForegroundColor = Color.Blue;
                        cell.Style.Pattern = BackgroundType.Solid;
                        isTemplateError = true;
                    }
                }
                while (!isFinishReadCell)
                {
                    #region"Read Cell"
                    SingleWellEntity singleWell = new SingleWellEntity();
                    singleWell.DataId = string.Concat(Guid.NewGuid());

                    bool isIdExist = false;
                    foreach (KeyValuePair<string, string> kvp in dict)
                    {
                        if (kvp.Key == id.ToString())
                        {
                            isIdExist = true;
                            break;
                        }
                    }
                    if (isIdExist)
                    {
                        cell.Style.ForegroundColor = Color.Red;
                        cell.Style.Pattern = BackgroundType.Solid;
                        isTemplateError = true;
                    }
                    else
                    {
                        dict[id.ToString()] = singleWell.DataId;
                    }

                    cell = cells[rowIndex, 1];
                    if (cell.Value != null)
                    {
                        try
                        {
                            sid = cell.IntValue.ToString();
                            bool isPidExist = false;

                            SingleWellDetailEntity singleWellDetailEntity = new SingleWellDetailEntity();
                            #region"ReadDetailCells"
                            cell = cells[rowIndex, 2];
                            if (cell.Value == null)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                            else
                            {
                                try
                                {
                                    singleWellDetailEntity.DataFileName = cell.StringValue;
                                }
                                catch (Exception)
                                {
                                    cell.Style.ForegroundColor = Color.Blue;
                                    cell.Style.Pattern = BackgroundType.Solid;
                                    isTemplateError = true;
                                }
                            }

                            cell = cells[rowIndex, 4];
                            if (cell.Value != null)
                            {
                                try
                                {
                                    singleWellDetailEntity.DetailPageNumber = cell.IntValue;
                                }
                                catch (Exception)
                                {
                                    cell.Style.ForegroundColor = Color.Blue;
                                    cell.Style.Pattern = BackgroundType.Solid;
                                    isTemplateError = true;
                                }
                            }
                            else
                            {
                                singleWellDetailEntity.DetailPageNumber = int.MinValue;
                            }

                            cell = cells[rowIndex, 5];
                            if (cell.Value != null)
                            {
                                try
                                {
                                    singleWellDetailEntity.A4 = cell.IntValue;
                                }
                                catch (Exception)
                                {
                                    cell.Style.ForegroundColor = Color.Blue;
                                    cell.Style.Pattern = BackgroundType.Solid;
                                    isTemplateError = true;
                                }
                            }
                            else
                            {
                                singleWellDetailEntity.DetailPageNumber = int.MinValue;
                            }

                            cell = cells[rowIndex, 6];
                            if (cell.Value != null)
                            {
                                try
                                {
                                    singleWellDetailEntity.A3 = cell.IntValue;
                                }
                                catch (Exception)
                                {
                                    cell.Style.ForegroundColor = Color.Blue;
                                    cell.Style.Pattern = BackgroundType.Solid;
                                    isTemplateError = true;
                                }
                            }
                            else
                            {
                                singleWellDetailEntity.DetailPageNumber = int.MinValue;
                            }

                            cell = cells[rowIndex, 7];
                            if (cell.Value != null)
                            {
                                try
                                {
                                    singleWellDetailEntity.A0 = cell.IntValue;
                                }
                                catch (Exception)
                                {
                                    cell.Style.ForegroundColor = Color.Blue;
                                    cell.Style.Pattern = BackgroundType.Solid;
                                    isTemplateError = true;
                                }
                            }
                            else
                            {
                                singleWellDetailEntity.DetailPageNumber = int.MinValue;
                            }

                            #endregion

                            if (!isTemplateError)
                            {
                                foreach (KeyValuePair<string, string> kvp in dict)
                                {
                                    if (kvp.Key == sid.ToString())
                                    {
                                        singleWellDetailEntity.WellDataID = kvp.Value;
                                        foreach (SingleWellEntity well in singleWells)
                                        {
                                            if (well.DataId == singleWellDetailEntity.WellDataID)
                                            {
                                                singleWellDetailEntity.DetailID = string.Concat(Guid.NewGuid());
                                                well.SingleWellDetailEntitys.Add(singleWellDetailEntity);
                                                break;
                                            }
                                        }
                                        isPidExist = true;
                                        break;
                                    }
                                }
                            }
                            if (!isPidExist)
                            {
                                cell.Style.ForegroundColor = Color.Yellow;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        rowIndex++;
                        cell = cells[rowIndex, 0];
                        if (cell.Value == null)
                        {
                            isFinishReadCell = true;
                        }
                        else
                        {
                            try
                            {
                                id = cell.IntValue.ToString();
                            }
                            catch (Exception)
                            {
                                id = cell.StringValue;
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        continue;
                    }

                    cell = cells[rowIndex, 2];
                    if (cell.Value == null || !File.Exists(cell.StringValue))
                    {
                        cell.Style.ForegroundColor = Color.Gray;
                        cell.Style.Pattern = BackgroundType.Solid;
                        isTemplateError = true;
                    }
                    else
                    {
                        try
                        {
                            if (File.Exists(cell.StringValue))
                            {
                                singleWell.DataFileName = Path.GetFileNameWithoutExtension(cell.StringValue);
                                entityRelateAttachFilePathDict[singleWell.DataId] = cell.StringValue;
                            }
                            else
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }

                    cell = cells[rowIndex, 3];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.WorkMode = cell.StringValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }

                    cell = cells[rowIndex, 4];
                    if (cell.Value != null)
                    {
                        try
                        {

                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }

                    cell = cells[rowIndex, 5];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.A4 = cell.IntValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        singleWell.A4 = int.MinValue;
                    }

                    cell = cells[rowIndex, 6];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.A3 = cell.IntValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        singleWell.A3 = int.MinValue;
                    }

                    cell = cells[rowIndex, 7];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.A0 = cell.IntValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        singleWell.A0 = int.MinValue;
                    }

                    cell = cells[rowIndex, 8];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.BeginDate = cell.DateTimeValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        singleWell.BeginDate = DateTime.MinValue;
                    }

                    cell = cells[rowIndex, 9];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.FinishDate = cell.DateTimeValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        singleWell.FinishDate = DateTime.MinValue;
                    }

                    cell = cells[rowIndex, 10];
                    if (cell.Value == null || string.IsNullOrEmpty(cell.StringValue))
                    {
                        cell.Style.ForegroundColor = Color.Gray;
                        cell.Style.Pattern = BackgroundType.Solid;
                        isTemplateError = true;
                    }
                    else
                    {
                        try
                        {
                            singleWell.WellCode = cell.StringValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }

                    cell = cells[rowIndex, 11];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.WellType = cell.StringValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }

                    cell = cells[rowIndex, 12];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.BeginWorkDate = cell.DateTimeValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        singleWell.BeginWorkDate = DateTime.MinValue;
                    }

                    cell = cells[rowIndex, 13];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.FinishWorkDate = cell.DateTimeValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        singleWell.FinishWorkDate = DateTime.MinValue;
                    }

                    cell = cells[rowIndex, 14];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.WellDepth = (decimal)cell.DoubleValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        singleWell.WellDepth = int.MinValue;
                    }

                    cell = cells[rowIndex, 15];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.ArchiveCode = cell.StringValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }

                    cell = cells[rowIndex, 16];
                    if (cell.Value != null)
                    {
                        try
                        {
                            singleWell.QuanZongCode = cell.StringValue;
                        }
                        catch (Exception)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }

                    #endregion

                    if (!isTemplateError)
                    {
                        singleWells.Add(singleWell);
                    }

                    rowIndex++;
                    cell = cells[rowIndex, 0];
                    if (cell.Value == null)
                    {
                        isFinishReadCell = true;
                    }
                    else
                    {
                        try
                        {
                            id = cell.IntValue.ToString();
                        }
                        catch (Exception)
                        {
                            id = cell.StringValue;
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                }

                if (isTemplateError)
                {
                    workbook.Save(excelFilePath);
                }
                returnSingleWells = singleWells;
                returnEntityRelateAttachFilePathDict = entityRelateAttachFilePathDict;
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool SingleWellProcess(string excelFilePath, out List<SingleWellEntity> returnSingleWells, out List<EntityIdAndTypeRelateAttachFilePath> returnEntityRelateAttachFilePathDict, CodeTable codeTable)
        {
            try
            {
                Dictionary<string, string> tempIdRelateEntityIdDict = new Dictionary<string, string>();
                List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict = new List<EntityIdAndTypeRelateAttachFilePath>();
                List<SingleWellEntity> singleWells = new List<SingleWellEntity>();
                bool isTemplateError = false;
                bool isFinishReadCell = false;

                Workbook workbook = new Workbook();
                workbook.Open(excelFilePath);
                Cells cells = workbook.Worksheets[0].Cells;
                cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, cells.End.Column);
                Cell cell = null;

                int rowIndex = 1;
                string id = "";
                string sid = "";

                cell = cells[rowIndex, 0];
                if (cell.Value != null)
                {
                    try
                    {
                        id = cell.IntValue.ToString();
                    }
                    catch (Exception)
                    {
                        id = "NaN";
                        cell.Style.ForegroundColor = Color.Blue;
                        cell.Style.Pattern = BackgroundType.Solid;
                        isTemplateError = true;
                    }
                }
                else
                {
                    id = "";
                }

                cell = cells[rowIndex, 1];
                if (cell.Value != null)
                {
                    try
                    {
                        sid = cell.IntValue.ToString();
                    }
                    catch (Exception)
                    {
                        sid = "NaN";
                        cell.Style.ForegroundColor = Color.Blue;
                        cell.Style.Pattern = BackgroundType.Solid;
                        isTemplateError = true;
                    }
                }
                else
                {
                    sid = "";
                }

                if (id == "" && sid == "")
                {
                    isFinishReadCell = true;
                }
                while (!isFinishReadCell)//id,sid至少一个不为空表示没读到excel的最后一行
                {
                    if (sid != "")//为项目明细
                    {
                        #region"ReadDetail"

                        if (id != "")
                        {
                            cells[rowIndex, 0].Style.ForegroundColor = Color.Gray;
                            cells[rowIndex, 0].Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        bool isPidExist = false;

                        SingleWellDetailEntity singleWellDetailEntity = new SingleWellDetailEntity();

                        #region"ReadDetailCells"
                        cell = cells[rowIndex, 2];
                        if (cell.Value == null)
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                        else
                        {
                            try
                            {
                                singleWellDetailEntity.DataFileName = cell.StringValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 4];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWellDetailEntity.DetailPageNumber = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 5];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWellDetailEntity.A4 = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 6];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWellDetailEntity.A3 = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 7];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWellDetailEntity.A0 = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 3];
                        if (cell.Value != null)
                        {
                            cell.Style.ForegroundColor = Color.Gray;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                        for (int i = 8; i <= 16; i++)
                        {
                            cell = cells[rowIndex, i];
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        #endregion


                        foreach (KeyValuePair<string, string> kvp in tempIdRelateEntityIdDict)
                        {
                            if (kvp.Key == sid.ToString())
                            {
                                if (!isTemplateError)
                                {
                                    singleWellDetailEntity.WellDataID = kvp.Value;
                                    foreach (SingleWellEntity well in singleWells)
                                    {
                                        if (well.DataId == singleWellDetailEntity.WellDataID)
                                        {
                                            singleWellDetailEntity.DetailID = string.Concat(Guid.NewGuid());
                                            well.SingleWellDetailEntitys.Add(singleWellDetailEntity);
                                            break;
                                        }
                                    }
                                }
                                isPidExist = true;
                                break;
                            }
                        }

                        if (sid != "NaN" && !isPidExist)
                        {
                            cells[rowIndex, 1].Style.ForegroundColor = Color.Yellow;
                            cells[rowIndex, 1].Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        #endregion
                    }
                    else//为著录项
                    {
                        #region"ReadCells"
                        SingleWellEntity singleWell = new SingleWellEntity();
                        singleWell.DataId = string.Concat(Guid.NewGuid());
                        bool isIdExist = false;
                        foreach (KeyValuePair<string, string> kvp in tempIdRelateEntityIdDict)
                        {
                            if (kvp.Key == id.ToString())
                            {
                                isIdExist = true;
                                break;
                            }
                        }
                        if (isIdExist)
                        {
                            cells[rowIndex, 0].Style.ForegroundColor = Color.Red;
                            cells[rowIndex, 0].Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                        else
                        {
                            if (id.ToString() != "NaN")
                            {
                                tempIdRelateEntityIdDict[id.ToString()] = singleWell.DataId;
                            }
                        }
                        cell = cells[rowIndex, 2];
                        if (cell.Value == null || !File.Exists(cell.StringValue))
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                        else
                        {
                            try
                            {
                                if (File.Exists(cell.StringValue))
                                {
                                    singleWell.DataFileName = Path.GetFileNameWithoutExtension(cell.StringValue);
                                    entityIdRelateAttachFilePathDict.Add(new EntityIdAndTypeRelateAttachFilePath(singleWell.DataId, cell.StringValue));
                                }
                                else
                                {
                                    cell.Style.ForegroundColor = Color.Blue;
                                    cell.Style.Pattern = BackgroundType.Solid;
                                    isTemplateError = true;
                                }
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 3];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.WorkMode = cell.StringValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 4];
                        if (cell.Value != null)
                        {
                            cell.Style.ForegroundColor = Color.Gray;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 5];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.A4 = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 6];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.A3 = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 7];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.A0 = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 8];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.BeginDate = cell.DateTimeValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 9];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.FinishDate = cell.DateTimeValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 10];
                        if (cell.Value == null || string.IsNullOrEmpty(cell.StringValue))
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                        else
                        {
                            try
                            {
                                singleWell.WellCode = cell.StringValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 11];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.WellType = cell.StringValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 12];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.BeginWorkDate = cell.DateTimeValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 13];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.FinishWorkDate = cell.DateTimeValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 14];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.WellDepth = (decimal)cell.DoubleValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 15];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.ArchiveCode = cell.StringValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 16];
                        if (cell.Value != null)
                        {
                            try
                            {
                                singleWell.QuanZongCode = cell.StringValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }


                        Dict category = null;
                        //Author:yidane
                        //Date:2014-03-27 0:07
                        cell = cells[rowIndex, 17];
                        if (cell.Value != null)
                        {
                            try
                            {
                                category = codeTable.Category.Find(dict => string.Equals(dict.Value, cell.StringValue.Trim()));
                                if (category != null)
                                {
                                    singleWell.Category = category.Key;
                                }
                                else
                                {
                                    throw new Exception(string.Format("{0}不是合法的编目", cell.StringValue));
                                }
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 18];
                        if (cell.Value != null)
                        {
                            try
                            {
                                if (category != null)
                                {
                                    if (category.ChildDictList == null)
                                        throw new Exception(String.Format("编目[{0}]无子项编目详细", category.Value));
                                    var categoryDetail = category.ChildDictList.Find(dict => string.Equals(dict.Value, cell.StringValue.Trim()));
                                    if (categoryDetail != null)
                                    {
                                        singleWell.CategoryDetail = categoryDetail.Key;
                                    }
                                }
                                else
                                {
                                    throw new Exception("请录入编目后再录入编目详细");
                                }
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        //Check Category & CategoryDetail 


                        if (!isTemplateError)
                        {
                            singleWells.Add(singleWell);
                        }
                        #endregion
                    }

                    rowIndex++;
                    cell = cells[rowIndex, 0];
                    if (cell.Value != null)
                    {
                        try
                        {
                            id = cell.IntValue.ToString();
                        }
                        catch (Exception)
                        {
                            id = "NaN";
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        id = "";
                    }

                    cell = cells[rowIndex, 1];
                    if (cell.Value != null)
                    {
                        try
                        {
                            sid = cell.IntValue.ToString();
                        }
                        catch (Exception)
                        {
                            sid = "NaN";
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                    }
                    else
                    {
                        sid = "";
                    }

                    if (id == "" && sid == "")
                    {
                        isFinishReadCell = true;
                    }
                    continue;
                }

                if (isTemplateError)
                {
                    workbook.Save(excelFilePath);
                }
                returnSingleWells = singleWells;
                returnEntityRelateAttachFilePathDict = entityIdRelateAttachFilePathDict;
                return isTemplateError;

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool DocumentArchiveProcess(string excelFilePath, out List<DocumentArchiveEntity> returnDocumentArchives, out Dictionary<string, string> returnEntityIdRelateAttachFilePathDict, CodeTable codeTable)
        {
            try
            {
                Dictionary<string, string> tempIdRelateEntityIdDict = new Dictionary<string, string>();
                Dictionary<string, string> entityIdRelateAttachFilePathDict = new Dictionary<string, string>();
                List<DocumentArchiveEntity> documentArchives = new List<DocumentArchiveEntity>();
                bool isTemplateError = false;
                bool isFinishReadCell = false;

                Workbook workbook = new Workbook();
                workbook.Open(excelFilePath);
                Cells cells = workbook.Worksheets[0].Cells;
                cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, cells.End.Column);
                Cell cell = null;

                string tempEntityId = string.Empty;

                int rowIndex = 1;
                bool hasValue = false;
                int fileCount = 0;

                for (int i = 0; i <= 17; i++)
                {
                    cell = cells[rowIndex, i];
                    if (cell.Value != null)
                    {
                        hasValue = true;
                        break;
                    }
                }
                if (!hasValue && fileCount <= 0)
                {
                    isFinishReadCell = true;
                }

                while (!isFinishReadCell)
                {
                    if (fileCount > 0)
                    {
                        #region"ReadFile"
                        for (int i = 0; i <= 0; i++)
                        {
                            cell = cells[rowIndex, i];
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        for (int i = 2; i <= 17; i++)
                        {
                            cell = cells[rowIndex, i];
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 1];
                        if (cell.Value != null && File.Exists(cell.StringValue))
                        {
                            if (!isTemplateError && !string.IsNullOrEmpty(tempEntityId))
                            {
                                entityIdRelateAttachFilePathDict.Add(tempEntityId, cell.StringValue);
                            }
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        fileCount--;

                        #endregion
                    }
                    else
                    {
                        #region"ReadCell"
                        DocumentArchiveEntity entity = new DocumentArchiveEntity();
                        entity.DataId = string.Concat(Guid.NewGuid());
                        tempEntityId = entity.DataId;

                        cell = cells[rowIndex, 0];
                        if (cell.Value != null)
                        {
                            try
                            {
                                fileCount = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            fileCount = 0;
                        }

                        cell = cells[rowIndex, 1];
                        if (cell.Value != null)
                        {
                            if (File.Exists(cell.StringValue))
                            {
                                entityIdRelateAttachFilePathDict.Add(entity.DataId, cell.StringValue);
                            }
                            else
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 2];
                        if (cell.Value != null)
                        {
                            entity.TempOrderNum = cell.StringValue;
                        }

                        cell = cells[rowIndex, 3];
                        if (cell != null && string.IsNullOrEmpty(cell.StringValue))
                        {
                            entity.Title = cell.StringValue;
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 4];
                        if (cell != null && string.IsNullOrEmpty(cell.StringValue))
                        {
                            entity.Publisher = cell.StringValue;
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 5];
                        if (cell.Value != null)
                        {
                            try
                            {
                                entity.PublishTime = cell.DateTimeValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 6];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            entity.FileOrgId = cell.StringValue;
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 7];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            //entity.F_KeepTime = cell.StringValue;
                            foreach (Dict dict in codeTable.KeepTimes)
                            {
                                if (dict.Value == cell.StringValue)
                                {
                                    entity.F_KeepTime = dict.Key.ToString();
                                    break;
                                }
                            }
                            if (string.IsNullOrEmpty(entity.F_KeepTime))
                            {
                                cell.Style.ForegroundColor = Color.Orange;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 8];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            //entity.F_CarrierType = cell.StringValue;
                            foreach (Dict dict in codeTable.CarrierTypes)
                            {
                                if (dict.Value == cell.StringValue)
                                {
                                    entity.F_CarrierType = dict.Key.ToString();
                                    break;
                                }
                            }
                            if (string.IsNullOrEmpty(entity.F_CarrierType))
                            {
                                cell.Style.ForegroundColor = Color.Orange;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 9];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            //entity.F_SecurityType = cell.StringValue;
                            foreach (Dict dict in codeTable.SecretTypes)
                            {
                                if (dict.Value == cell.StringValue)
                                {
                                    entity.F_SecurityType = dict.Key.ToString();
                                    break;
                                }
                            }
                            if (string.IsNullOrEmpty(entity.F_SecurityType))
                            {
                                cell.Style.ForegroundColor = Color.Orange;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 10];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            //TODO
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 11];
                        if (cell.Value != null)
                        {
                            try
                            {
                                entity.PageNum = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        cell = cells[rowIndex, 12];
                        if (cell != null)
                        {
                            try
                            {
                                entity.MainBodyNum = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 13];
                        if (cell != null)
                        {
                            try
                            {
                                entity.DoplicateBodyNum = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 14];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            entity.Summary = cell.StringValue;
                        }

                        cell = cells[rowIndex, 15];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            entity.Remark = cell.StringValue;
                        }

                        cell = cells[rowIndex, 16];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            entity.StorageType = cell.StringValue;
                        }
                        cell = cells[rowIndex, 17];
                        if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
                        {
                            entity.FileNum = cell.StringValue;
                        }

                        if (!isTemplateError)
                        {
                            documentArchives.Add(entity);
                        }

                        #endregion
                    }

                    rowIndex++;
                    hasValue = false;
                    for (int i = 0; i <= 17; i++)
                    {
                        cell = cells[rowIndex, i];
                        if (cell.Value != null)
                        {
                            hasValue = true;
                            break;
                        }
                    }

                    if (!hasValue && fileCount <= 0)
                    {
                        isFinishReadCell = true;
                    }
                }

                if (isTemplateError)
                {
                    workbook.Save(excelFilePath);
                }
                returnDocumentArchives = documentArchives;
                returnEntityIdRelateAttachFilePathDict = entityIdRelateAttachFilePathDict;
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool AccountVoucherArchiveProcess(string excelFilePath, out List<AccountVoucherArchiveEntity> returnEntities, out Dictionary<string, string> returnEntityIdRelateAttachFilePathDict, CodeTable codeTable)
        {
            try
            {
                Dictionary<string, string> entityIdRelateAttachFilePathDict = new Dictionary<string, string>();
                List<AccountVoucherArchiveEntity> accountVoucherArchives = new List<AccountVoucherArchiveEntity>();
                bool isTemplateError = false;
                bool isFinishReadCell = false;

                Workbook workbook = new Workbook();
                workbook.Open(excelFilePath);


                Cells cells = workbook.Worksheets[0].Cells;
                cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, cells.End.Column);
                Cell cell = null;

                Dictionary<string, string> tempIdRelateEntityIdDict = new Dictionary<string, string>();
                string tempEntityId = string.Empty;
                int rowIndex = 1;
                bool hasValue = false;
                int fileCount = 0;

                #region"sheet0"

                cell = cells[rowIndex, 0];
                if (cell.Value != null)
                {
                    hasValue = true;
                }
                if (!hasValue && fileCount <= 0)
                {
                    isFinishReadCell = true;
                }

                while (!isFinishReadCell)
                {
                    if (fileCount > 0)
                    {
                        #region"ReadFile"
                        for (int i = 0; i <= 1; i++)
                        {
                            cell = cells[rowIndex, i];
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        for (int i = 3; i <= 19; i++)
                        {
                            cell = cells[rowIndex, i];
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 2];
                        if (cell.Value != null && File.Exists(cell.StringValue))
                        {
                            if (!isTemplateError && !string.IsNullOrEmpty(tempEntityId))
                            {
                                entityIdRelateAttachFilePathDict.Add(tempEntityId, cell.StringValue);
                            }
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        fileCount--;
                        #endregion
                    }
                    else
                    {
                        #region"ReadCell"
                        AccountVoucherArchiveEntity entity = new AccountVoucherArchiveEntity();
                        entity.DataId = string.Concat(Guid.NewGuid());

                        cell = cells[rowIndex, 0];
                        string id = "";
                        try
                        {
                            id = cell.IntValue.ToString();
                        }
                        catch (Exception)
                        {
                            id = "NaN";
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                        if (id != "NaN")
                        {
                            bool isIdExist = false;
                            foreach (KeyValuePair<string, string> kvp in tempIdRelateEntityIdDict)
                            {
                                if (kvp.Key == id.ToString())
                                {
                                    isIdExist = true;
                                    break;
                                }
                            }
                            if (isIdExist)
                            {
                                cells[rowIndex, 0].Style.ForegroundColor = Color.Red;
                                cells[rowIndex, 0].Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                            else
                            {
                                tempIdRelateEntityIdDict[id.ToString()] = entity.DataId;
                            }
                        }

                        cell = cells[rowIndex, 1];
                        if (cell.Value != null)
                        {
                            try
                            {
                                tempEntityId = entity.DataId;
                                fileCount = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                tempEntityId = string.Empty;
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            tempEntityId = string.Empty;
                            fileCount = 0;
                        }

                        cell = cells[rowIndex, 2];
                        if (fileCount > 0)
                        {
                            if (File.Exists(cell.StringValue))
                            {
                                entityIdRelateAttachFilePathDict.Add(entity.DataId, cell.StringValue);
                            }
                            else
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }


                        #endregion
                    }
                    rowIndex++;
                    hasValue = false;
                    cell = cells[rowIndex, 0];
                    if (cell.Value != null)
                    {
                        hasValue = true;
                    }
                    if (!hasValue && fileCount <= 0)
                    {
                        isFinishReadCell = true;
                    }
                    continue;
                }
                #endregion

                #region"sheet1"
                cells = workbook.Worksheets[1].Cells;
                cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, cells.End.Column);
                cell = null;
                tempEntityId = string.Empty;
                rowIndex = 1;
                hasValue = false;
                fileCount = 0;

                cell = cells[rowIndex, 0];
                if (cell.Value != null)
                {
                    hasValue = true;
                }
                if (!hasValue && fileCount <= 0)
                {
                    isFinishReadCell = true;
                }

                while (!isFinishReadCell)
                {
                    if (fileCount > 0)
                    {
                        #region"ReadFile"
                        for (int i = 0; i <= 1; i++)
                        {
                            cell = cells[rowIndex, i];
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        for (int i = 3; i <= 11; i++)
                        {
                            cell = cells[rowIndex, i];
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 2];
                        if (cell.Value != null && File.Exists(cell.StringValue))
                        {
                            if (!isTemplateError && !string.IsNullOrEmpty(tempEntityId))
                            {
                                entityIdRelateAttachFilePathDict.Add(tempEntityId, cell.StringValue);
                            }
                        }
                        else
                        {
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }

                        fileCount--;
                        #endregion
                    }
                    else
                    {
                        #region"ReadCell"
                        PageFileEntity entity = new PageFileEntity();
                        entity.DataId = string.Concat(Guid.NewGuid());

                        string id = string.Empty;
                        bool isIdExist = false;

                        cell = cells[rowIndex, 0];
                        try
                        {
                            id = cell.IntValue.ToString();
                        }
                        catch (Exception)
                        {
                            id = "NaN";
                            cell.Style.ForegroundColor = Color.Blue;
                            cell.Style.Pattern = BackgroundType.Solid;
                            isTemplateError = true;
                        }
                        if (id != "NaN")
                        {
                            foreach (KeyValuePair<string, string> kvp in tempIdRelateEntityIdDict)
                            {
                                if (kvp.Key == id.ToString())
                                {
                                    isIdExist = true;
                                    break;
                                }
                            }
                            if (!isIdExist)
                            {
                                cells[rowIndex, 0].Style.ForegroundColor = Color.Yellow;
                                cells[rowIndex, 0].Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 1];
                        if (cell.Value != null)
                        {
                            try
                            {
                                tempEntityId = entity.DataId;
                                fileCount = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                tempEntityId = string.Empty;
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            tempEntityId = string.Empty;
                            fileCount = 0;
                        }

                        cell = cells[rowIndex, 2];
                        if (fileCount > 0)
                        {
                            if (File.Exists(cell.StringValue))
                            {
                                if (!isTemplateError && id != "NaN" && !isIdExist)
                                {
                                    entityIdRelateAttachFilePathDict.Add(entity.DataId, cell.StringValue);
                                }
                            }
                            else
                            {
                                cell.Style.ForegroundColor = Color.Blue;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }
                        else
                        {
                            if (cell.Value != null)
                            {
                                cell.Style.ForegroundColor = Color.Gray;
                                cell.Style.Pattern = BackgroundType.Solid;
                                isTemplateError = true;
                            }
                        }

                        cell = cells[rowIndex, 3];

                        if (!isTemplateError && id != "NaN" && !isIdExist)
                        {

                        }

                        #endregion
                    }
                    rowIndex++;
                    hasValue = false;
                    cell = cells[rowIndex, 0];
                    if (cell.Value != null)
                    {
                        hasValue = true;
                    }
                    if (!hasValue && fileCount <= 0)
                    {
                        isFinishReadCell = true;
                    }
                    continue;
                }
                #endregion

                #region"Sheet2"
                cells = workbook.Worksheets[1].Cells;
                cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, cells.End.Column);
                cell = null;
                tempEntityId = string.Empty;
                rowIndex = 1;
                hasValue = false;
                fileCount = 0;

                cell = cells[rowIndex, 0];
                if (cell.Value != null)
                {
                    hasValue = true;
                }
                if (!hasValue && fileCount <= 0)
                {
                    isFinishReadCell = true;
                }

                while (!isFinishReadCell)
                {
                    if (fileCount > 0)
                    {
                        #region"ReadFile"
                        #endregion
                    }
                    else
                    {
                        #region"ReadCell"
                        #endregion
                    }
                    rowIndex++;
                    hasValue = false;
                    cell = cells[rowIndex, 0];
                    if (cell.Value != null)
                    {
                        hasValue = true;
                    }
                    if (!hasValue && fileCount <= 0)
                    {
                        isFinishReadCell = true;
                    }
                    continue;
                }
                #endregion

                if (isTemplateError)
                {
                    workbook.Save(excelFilePath);
                }
                returnEntities = accountVoucherArchives;
                returnEntityIdRelateAttachFilePathDict = entityIdRelateAttachFilePathDict;
                return isTemplateError;

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }


        private bool ReadSheet1<T>(Cells cells, List<T> entities, List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict, out Dictionary<string, string> returnTempIdRelateEntityIdDict, CodeTable codeTable, MetaDataRead<T> metaDataReadFunc, int archiveType, bool isTemplateError)
        {
            try
            {
                Dictionary<string, string> tempIdRelateEntityIdDict = new Dictionary<string, string>();

                bool isFinishReadCell = false;

                if (cells.End.Row > cells.Start.Row)
                {
                    cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, 30);
                }
                Cell cell = null;

                string tempEntityId = string.Empty;
                int rowIndex = 1;
                bool hasValue = false;
                int fileCount = 0;

                cell = cells[rowIndex, 0];
                if (cell.Value != null)
                {
                    hasValue = true;
                }
                if (!hasValue && fileCount <= 0)
                {
                    isFinishReadCell = true;
                }

                while (!isFinishReadCell)
                {
                    if (fileCount > 0)
                    {
                        #region"ReadFile"

                        isTemplateError = ReadCellFileArchive(cells, rowIndex, isTemplateError, tempEntityId, entityIdRelateAttachFilePathDict, archiveType);
                        fileCount--;

                        #endregion
                    }
                    else
                    {
                        #region"ReadCell"

                        string dataId = string.Concat(Guid.NewGuid());
                        tempEntityId = dataId;

                        string id = string.Empty;
                        bool isIdExist = false;

                        cell = cells[rowIndex, 0];
                        try
                        {
                            id = cell.StringValue;
                        }
                        catch (Exception)
                        {
                            id = "error";
                            isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                        }
                        if (id != "error")
                        {
                            foreach (KeyValuePair<string, string> kvp in tempIdRelateEntityIdDict)
                            {
                                if (kvp.Key == id.ToString())
                                {
                                    isIdExist = true;
                                    break;
                                }
                            }
                            if (isIdExist)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Red);
                            }
                            else
                            {
                                tempIdRelateEntityIdDict[id.ToString()] = dataId;
                            }
                        }

                        cell = cells[rowIndex, 1];
                        if (cell.Value != null)
                        {
                            try
                            {
                                fileCount = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                                break;
                            }
                        }
                        else
                        {
                            fileCount = 0;
                        }

                        cell = cells[rowIndex, 2];
                        if (fileCount > 0)
                        {
                            if (File.Exists(cell.StringValue))
                            {
                                if (!isTemplateError)
                                {
                                    entityIdRelateAttachFilePathDict.Add(new EntityIdAndTypeRelateAttachFilePath(dataId, cell.StringValue));
                                }
                            }
                            else
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                            }
                            fileCount--;
                        }
                        else
                        {
                            if (cell.Value != null)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                            }
                        }

                        #region"ReadToEntity"

                        isTemplateError = metaDataReadFunc(cells, rowIndex, entities, dataId, archiveType, isTemplateError, codeTable);

                        #endregion

                        #endregion
                    }
                    rowIndex++;
                    hasValue = false;
                    cell = cells[rowIndex, 0];
                    if (cell.Value != null)
                    {
                        hasValue = true;
                    }
                    if (!hasValue && fileCount <= 0)
                    {
                        isFinishReadCell = true;
                    }
                    continue;
                }
                returnTempIdRelateEntityIdDict = tempIdRelateEntityIdDict;
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private bool ReadSheet2<T>(Cells cells, List<T> entities, List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict, Dictionary<string, string> tempIdRelateEntityIdDict, CodeTable codeTable, ManagePageFileMetaDataRead<T> metaDataReadFunc, int archiveType, bool isTemplateError)
        {
            try
            {
                bool isFinishReadCell = false;

                if (cells.End.Row > cells.Start.Row)
                {
                    cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, 30);
                }
                Cell cell = null;

                string tempEntityId = string.Empty;
                int rowIndex = 1;
                bool hasValue = false;
                int fileCount = 0;

                cell = cells[rowIndex, 0];
                if (cell.Value != null)
                {
                    hasValue = true;
                }
                if (!hasValue && fileCount <= 0)
                {
                    isFinishReadCell = true;
                }

                while (!isFinishReadCell)
                {
                    if (fileCount > 0)
                    {
                        #region"ReadFile"
                        isTemplateError = ReadCellFileOwnerPageFile(cells, rowIndex, isTemplateError, tempEntityId, entityIdRelateAttachFilePathDict, archiveType);
                        fileCount--;
                        #endregion
                    }
                    else
                    {
                        #region"ReadCell"

                        string dataId = string.Concat(Guid.NewGuid());
                        tempEntityId = dataId;
                        string relateEntityId = string.Empty;
                        string id = string.Empty;
                        bool isIdExist = false;

                        cell = cells[rowIndex, 0];
                        try
                        {
                            id = cell.StringValue;
                        }
                        catch (Exception)
                        {
                            id = "error";
                            isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                        }
                        if (id != "error")
                        {
                            foreach (KeyValuePair<string, string> kvp in tempIdRelateEntityIdDict)
                            {
                                if (kvp.Key == id.ToString())
                                {
                                    relateEntityId = kvp.Value;
                                    isIdExist = true;
                                    break;
                                }
                            }
                            if (!isIdExist || string.IsNullOrEmpty(relateEntityId))
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Yellow);
                            }
                        }

                        cell = cells[rowIndex, 1];
                        if (cell.Value != null)
                        {
                            try
                            {
                                fileCount = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                                break;
                            }
                        }
                        else
                        {
                            fileCount = 0;
                        }

                        cell = cells[rowIndex, 2];
                        if (fileCount > 0)
                        {
                            if (File.Exists(cell.StringValue))
                            {
                                if (!isTemplateError)
                                {
                                    entityIdRelateAttachFilePathDict.Add(new EntityIdAndTypeRelateAttachFilePath(dataId, cell.StringValue, "PageFile"));
                                }
                            }
                            else
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                            }
                            fileCount--;
                        }
                        else
                        {
                            if (cell.Value != null)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                            }
                        }

                        #region"ReadToEntity"

                        isTemplateError = metaDataReadFunc(cells, rowIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);

                        #endregion

                        #endregion
                    }
                    rowIndex++;
                    hasValue = false;
                    cell = cells[rowIndex, 0];
                    if (cell.Value != null)
                    {
                        hasValue = true;
                    }
                    if (!hasValue && fileCount <= 0)
                    {
                        isFinishReadCell = true;
                    }
                    continue;
                }
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private bool ReadSheet3<T>(Cells cells, List<T> entities, List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict, CodeTable codeTable, UnManagePageFileMetaDataRead<T> metaDataReadFunc, int archiveType, bool isTemplateError)
        {
            try
            {
                bool isFinishReadCell = false;

                if (cells.End.Row > cells.Start.Row)
                {
                    cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, 30);
                }
                Cell cell = null;

                string tempEntityId = string.Empty;
                int rowIndex = 1;
                bool hasValue = false;
                int fileCount = 0;

                cell = cells[rowIndex, 0];
                if (cell.Value != null)
                {
                    hasValue = true;
                }
                if (!hasValue && fileCount <= 0)
                {
                    isFinishReadCell = true;
                }

                while (!isFinishReadCell)
                {
                    if (fileCount > 0)
                    {
                        #region"ReadFile"

                        isTemplateError = ReadCellFilePageFile(cells, rowIndex, isTemplateError, tempEntityId, entityIdRelateAttachFilePathDict, archiveType);

                        fileCount--;

                        #endregion
                    }
                    else
                    {
                        #region"ReadCell"

                        string dataId = string.Concat(Guid.NewGuid());
                        tempEntityId = dataId;

                        cell = cells[rowIndex, 0];
                        if (cell.Value != null)
                        {
                            try
                            {
                                fileCount = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                                break;
                            }
                        }
                        else
                        {
                            isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                            break;
                        }

                        cell = cells[rowIndex, 1];
                        if (fileCount > 0)
                        {
                            if (File.Exists(cell.StringValue))
                            {
                                if (!isTemplateError)
                                {
                                    entityIdRelateAttachFilePathDict.Add(new EntityIdAndTypeRelateAttachFilePath(dataId, cell.StringValue));
                                }
                            }
                            else
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                            }
                            fileCount--;
                        }
                        else
                        {
                            if (cell.Value != null)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                            }
                        }

                        #region"ReadToEntity"

                        isTemplateError = metaDataReadFunc(cells, rowIndex, entities, dataId, archiveType, isTemplateError, codeTable);

                        #endregion

                        #endregion
                    }
                    rowIndex++;
                    hasValue = false;
                    cell = cells[rowIndex, 0];
                    if (cell.Value != null)
                    {
                        hasValue = true;
                    }
                    if (!hasValue && fileCount <= 0)
                    {
                        isFinishReadCell = true;
                    }
                    continue;
                }
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        //Author Yidane
        //Date:2014年4月21日00:19:34
        private bool ReadSheet4<T>(Cells cells, List<T> entities, List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict, CodeTable codeTable, UnManagePageFileMetaDataRead<T> metaDataReadFunc, int archiveType, bool isTemplateError)
        {
            try
            {
                bool isFinishReadCell = false;

                if (cells.End.Row > cells.Start.Row)
                {
                    cells.ClearFormats(cells.Start.Row + 1, cells.Start.Column, cells.End.Row, 30);
                }
                Cell cell = null;

                string tempEntityId = string.Empty;
                int rowIndex = 1;
                bool hasValue = false;
                int fileCount = 0;

                cell = cells[rowIndex, 0];
                if (cell.Value != null)
                {
                    hasValue = true;
                }
                if (!hasValue && fileCount <= 0)
                {
                    isFinishReadCell = true;
                }

                while (!isFinishReadCell)
                {
                    if (fileCount > 0)
                    {
                        #region"ReadFile"

                        isTemplateError = ReadCellFileArchive(cells, rowIndex, isTemplateError, tempEntityId, entityIdRelateAttachFilePathDict, archiveType);

                        fileCount--;

                        #endregion
                    }
                    else
                    {
                        #region"ReadCell"

                        string dataId = string.Concat(Guid.NewGuid());
                        tempEntityId = dataId;

                        //第二列存放的是数据拥有多少附件
                        cell = cells[rowIndex, 1];
                        if (cell.Value != null)
                        {
                            try
                            {
                                fileCount = cell.IntValue;
                            }
                            catch (Exception)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                                break;
                            }
                        }
                        else
                        {
                            isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                            break;
                        }

                        //第三行存放的是附件的绝对路径
                        cell = cells[rowIndex, 2];
                        if (fileCount > 0)
                        {
                            if (File.Exists(cell.StringValue))
                            {
                                if (!isTemplateError)
                                {
                                    entityIdRelateAttachFilePathDict.Add(new EntityIdAndTypeRelateAttachFilePath(dataId, cell.StringValue));
                                }
                            }
                            else
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                            }
                            fileCount--;
                        }
                        else
                        {
                            if (cell.Value != null)
                            {
                                isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                            }
                        }

                        #region"ReadToEntity"

                        isTemplateError = metaDataReadFunc(cells, rowIndex, entities, dataId, archiveType, isTemplateError, codeTable);

                        #endregion

                        #endregion
                    }
                    rowIndex++;
                    hasValue = false;
                    cell = cells[rowIndex, 0];
                    if (cell.Value != null)
                    {
                        hasValue = true;
                    }
                    if (!hasValue && fileCount <= 0)
                    {
                        isFinishReadCell = true;
                    }
                    continue;
                }
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public bool ReadExcel(string excelFilePath, CodeTable codeTable, string type, out UpdateArchiveAndPageFileModel<CommonEntityDTO, CommonEntityDTO> returnModel, out List<EntityIdAndTypeRelateAttachFilePath> returnEntityIdRelateAttachFilePathDict, string returnSaveErrorTemplatePath)
        {
            int archiveType = 0;
            if (!int.TryParse(type, out archiveType))
            {
                throw new Exception("Get archiveType Failed!");
            }

            UpdateArchiveAndPageFileModel<CommonEntityDTO, CommonEntityDTO> model = new UpdateArchiveAndPageFileModel<CommonEntityDTO, CommonEntityDTO>();
            List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict = new List<EntityIdAndTypeRelateAttachFilePath>();
            List<CommonEntityDTO> entities = new List<CommonEntityDTO>();
            List<CommonEntityDTO> pageFileEntities = new List<CommonEntityDTO>();
            bool isTemplateError = false;

            Workbook workbook = new Workbook();
            workbook.Open(excelFilePath);
            Cells cells = null;

            if (archiveType == 3 || archiveType == 4 || archiveType == 5 || archiveType == 61 || archiveType == 62 || archiveType == 63 || archiveType == 64)
            {
                Dictionary<string, string> tempIdRelateEntityIdDict = null;
                cells = workbook.Worksheets[0].Cells;
                isTemplateError = ReadSheet1(cells, entities, entityIdRelateAttachFilePathDict, out tempIdRelateEntityIdDict, codeTable, ArchiveRead, archiveType, isTemplateError);

                cells = workbook.Worksheets[1].Cells;
                isTemplateError = ReadSheet2(cells, pageFileEntities, entityIdRelateAttachFilePathDict, tempIdRelateEntityIdDict, codeTable, ArchiveOwnerPageFileRead, archiveType, isTemplateError);
            }
            else if (archiveType == 1 || archiveType == 2 || archiveType == 71 || archiveType == 72 || archiveType == 81 || archiveType == 82 || archiveType == 83 || archiveType == 91)
            {
                cells = workbook.Worksheets[0].Cells;
                isTemplateError = ReadSheet3(cells, entities, entityIdRelateAttachFilePathDict, codeTable, ArchivePageFileRead, archiveType, isTemplateError);
            }
            //Author Yidane
            //Date:2014年4月21日00:18:17
            else if (archiveType == 101 || archiveType == 102 || archiveType == 7101 || archiveType == 7102)
            {
                cells = workbook.Worksheets[0].Cells;
                isTemplateError = ReadSheet4<CommonEntityDTO>(cells, entities, entityIdRelateAttachFilePathDict, codeTable, ArchivePageFileReadEx, archiveType, isTemplateError);
            }
            else
            {
                throw new Exception("该档案类型模板不存在！");
            }
            if (isTemplateError)
            {
                workbook.Save(returnSaveErrorTemplatePath);
            }

            model.Archives = entities;
            model.PageFiles = pageFileEntities;
            returnModel = model;
            returnEntityIdRelateAttachFilePathDict = entityIdRelateAttachFilePathDict;
            return isTemplateError;
        }

        private bool ReadCellFileArchive(Cells cells, int rowIndex, bool isTemplateError, string tempEntityId, List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict, int archiveType)
        {
            try
            {
                int fileColumnIndex = 0;
                int endColumnIndex = 0;

                switch (archiveType)
                {
                    case 3:
                        fileColumnIndex = 2;
                        endColumnIndex = 21;
                        break;
                    case 4:
                        fileColumnIndex = 2;
                        endColumnIndex = 20;
                        break;
                    case 5:
                        fileColumnIndex = 2;
                        endColumnIndex = 21;
                        break;
                    case 61:
                        fileColumnIndex = 2;
                        endColumnIndex = 21;
                        break;
                    case 62:
                        fileColumnIndex = 2;
                        endColumnIndex = 16;
                        break;
                    case 63:
                        fileColumnIndex = 2;
                        endColumnIndex = 17;
                        break;
                    case 64:
                        fileColumnIndex = 2;
                        endColumnIndex = 17;
                        break;
                    //case 71:
                    //    fileColumnIndex = 1;
                    //    endColumnIndex = 17;
                    //    break;
                    //case 72:
                    //    fileColumnIndex = 1;
                    //    endColumnIndex = 21;
                    //    break;
                    case 101:
                        fileColumnIndex = 2;
                        endColumnIndex = 24;
                        break;
                    case 102:
                        fileColumnIndex = 2;
                        endColumnIndex = 24;
                        break;
                    case 7101:
                        fileColumnIndex = 2;
                        endColumnIndex = 21;
                        break;
                    case 7102:
                        fileColumnIndex = 2;
                        endColumnIndex = 21;
                        break;
                    default:
                        throw new Exception("type Error!");
                }

                Cell cell = null;
                for (int i = 0; i <= fileColumnIndex - 1; i++)
                {
                    cell = cells[rowIndex, i];
                    if (cell.Value != null)
                    {
                        isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                    }
                }
                for (int i = fileColumnIndex + 1; i <= endColumnIndex; i++)
                {
                    cell = cells[rowIndex, i];
                    if (cell.Value != null)
                    {
                        isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                    }
                }

                cell = cells[rowIndex, fileColumnIndex];
                if (cell.Value != null && File.Exists(cell.StringValue))
                {
                    if (!isTemplateError && !string.IsNullOrEmpty(tempEntityId))
                    {
                        entityIdRelateAttachFilePathDict.Add(new EntityIdAndTypeRelateAttachFilePath(tempEntityId, cell.StringValue));
                    }
                }
                else
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private bool ReadCellFilePageFile(Cells cells, int rowIndex, bool isTemplateError, string tempEntityId, List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict, int archiveType)
        {
            try
            {
                int fileColumnIndex = 0;
                int endColumnIndex = 0;

                switch (archiveType)
                {
                    case 1:
                        fileColumnIndex = 1;
                        endColumnIndex = 18;
                        break;
                    case 2:
                        fileColumnIndex = 1;
                        endColumnIndex = 17;
                        break;
                    case 71:
                        fileColumnIndex = 1;
                        endColumnIndex = 18;
                        break;
                    case 72:
                        fileColumnIndex = 1;
                        endColumnIndex = 22;
                        break;
                    case 81:
                        fileColumnIndex = 1;
                        endColumnIndex = 16;
                        break;
                    case 82:
                        fileColumnIndex = 1;
                        endColumnIndex = 16;
                        break;
                    case 83:
                        fileColumnIndex = 1;
                        endColumnIndex = 16;
                        break;
                    case 91:
                        fileColumnIndex = 1;
                        endColumnIndex = 16;
                        break;
                    default:
                        throw new Exception("type Error!");
                }

                Cell cell = null;
                for (int i = 0; i <= fileColumnIndex - 1; i++)
                {
                    cell = cells[rowIndex, i];
                    if (cell.Value != null)
                    {
                        isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                    }
                }
                for (int i = fileColumnIndex + 1; i <= endColumnIndex; i++)
                {
                    cell = cells[rowIndex, i];
                    if (cell.Value != null)
                    {
                        isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                    }
                }

                cell = cells[rowIndex, fileColumnIndex];
                if (cell.Value != null && File.Exists(cell.StringValue))
                {
                    if (!isTemplateError && !string.IsNullOrEmpty(tempEntityId))
                    {
                        entityIdRelateAttachFilePathDict.Add(new EntityIdAndTypeRelateAttachFilePath(tempEntityId, cell.StringValue));
                    }
                }
                else
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private bool ReadCellFileOwnerPageFile(Cells cells, int rowIndex, bool isTemplateError, string tempEntityId, List<EntityIdAndTypeRelateAttachFilePath> entityIdRelateAttachFilePathDict, int archiveType)
        {
            try
            {
                int fileColumnIndex = 0;
                int endColumnIndex = 0;

                switch (archiveType)
                {
                    case 3:
                        fileColumnIndex = 2;
                        endColumnIndex = 14;
                        break;
                    case 4:
                        fileColumnIndex = 2;
                        endColumnIndex = 13;
                        break;
                    case 5:
                        fileColumnIndex = 2;
                        endColumnIndex = 14;
                        break;
                    case 61:
                        fileColumnIndex = 2;
                        endColumnIndex = 11;
                        break;
                    case 62:
                        fileColumnIndex = 2;
                        endColumnIndex = 11;
                        break;
                    case 63:
                        fileColumnIndex = 2;
                        endColumnIndex = 11;
                        break;
                    case 64:
                        fileColumnIndex = 2;
                        endColumnIndex = 11;
                        break;
                    //case 71:
                    //    fileColumnIndex = 0;
                    //    endColumnIndex = 0;
                    //    break;
                    //case 72:
                    //    fileColumnIndex = 0;
                    //    endColumnIndex = 0;
                    //    break;
                    default:
                        throw new Exception("type Error!");
                }

                Cell cell = null;
                for (int i = 0; i <= fileColumnIndex - 1; i++)
                {
                    cell = cells[rowIndex, i];
                    if (cell.Value != null)
                    {
                        isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                    }
                }
                for (int i = fileColumnIndex + 1; i <= endColumnIndex; i++)
                {
                    cell = cells[rowIndex, i];
                    if (cell.Value != null)
                    {
                        isTemplateError = ExcelCellReadErrorProcess(cell, Color.Gray);
                    }
                }

                cell = cells[rowIndex, fileColumnIndex];
                if (cell.Value != null && File.Exists(cell.StringValue))
                {
                    if (!isTemplateError && !string.IsNullOrEmpty(tempEntityId))
                    {
                        entityIdRelateAttachFilePathDict.Add(new EntityIdAndTypeRelateAttachFilePath(tempEntityId, cell.StringValue, "PageFile"));
                    }
                }
                else
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
                return isTemplateError;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private bool ArchiveRead(Cells cells, int rowIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            int startColumnIndex = 0;
            switch (archiveType)
            {
                case 3:
                    startColumnIndex = 3;
                    isTemplateError = KYArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 4:
                    startColumnIndex = 3;
                    isTemplateError = BuildArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 5:
                    startColumnIndex = 3;
                    isTemplateError = SBArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 61:
                    startColumnIndex = 3;
                    isTemplateError = KJPZArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 62:
                    startColumnIndex = 3;
                    isTemplateError = KJZBArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 63:
                    startColumnIndex = 3;
                    isTemplateError = CWBGArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 64:
                    startColumnIndex = 3;
                    isTemplateError = KJQTArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                //Author:Yidane
                //Date:2014年4月22日00:34:20
                case 101:

                    break;
                case 102:
                    break;
                case 7101:
                    break;
                case 7102:
                    break;
                default:
                    throw new Exception("type Error!");
            }
            return isTemplateError;
        }

        private bool ArchiveOwnerPageFileRead(Cells cells, int rowIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            int startColumnIndex = 0;
            switch (archiveType)
            {
                case 3:
                    startColumnIndex = 3;
                    isTemplateError = KYOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                    break;
                case 4:
                    startColumnIndex = 3;
                    isTemplateError = BuildOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                    break;
                case 5:
                    startColumnIndex = 3;
                    isTemplateError = SBOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                    break;
                case 61:
                    startColumnIndex = 3;
                    isTemplateError = KJPZOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                    break;
                case 62:
                    startColumnIndex = 3;
                    isTemplateError = KJZBOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                    break;
                case 63:
                    startColumnIndex = 3;
                    isTemplateError = CWBGOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                    break;
                case 64:
                    startColumnIndex = 3;
                    isTemplateError = KJQTOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                    break;
                //case 71:
                //    startColumnIndex = 3;
                //    isTemplateError = KTZHOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                //    break;
                //case 72:
                //    startColumnIndex = 3;
                //    isTemplateError = KZDJOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, relateEntityId, archiveType, isTemplateError, codeTable);
                //    break;
                default:
                    throw new Exception("type Error!");
            }
            return isTemplateError;
        }

        private bool ArchivePageFileRead(Cells cells, int rowIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            int startColumnIndex = 0;
            switch (archiveType)
            {
                case 1:
                    startColumnIndex = 2;
                    isTemplateError = WSPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 2:
                    startColumnIndex = 2;
                    isTemplateError = GPPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 71:
                    startColumnIndex = 2;
                    isTemplateError = KTZHPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 72:
                    startColumnIndex = 2;
                    isTemplateError = KTDJPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 81:
                case 82:
                case 83:
                    startColumnIndex = 2;
                    isTemplateError = SXPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 91:
                    startColumnIndex = 2;
                    isTemplateError = RYPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                default:
                    throw new Exception("type Error!");
            }
            return isTemplateError;
        }


        //Author:Yidane
        //Date:2014年4月24日22:13:55
        #region Yidane
        private bool ArchivePageFileReadEx(Cells cells, int rowIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            int startColumnIndex = 0;
            switch (archiveType)
            {
                case 101:
                    startColumnIndex = 3;
                    isTemplateError = WSArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 102:
                    startColumnIndex = 3;
                    isTemplateError = WSOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 7101:
                    startColumnIndex = 3;
                    isTemplateError = ZHArchiveRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                case 7102:
                    startColumnIndex = 3;
                    isTemplateError = ZHOwnerPageFileRead(cells, rowIndex, startColumnIndex, entities, dataId, archiveType, isTemplateError, codeTable);
                    break;
                default:
                    throw new Exception("type Error!");
            }
            return isTemplateError;
        }

        /// <summary>
        /// 文书卷
        /// </summary>
        private bool WSArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            //临时序号
            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //档号
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            //题名
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            //起日期
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //止日期
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //文件日期
            isTemplateError = RecordTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档日期
            isTemplateError = FileTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //载体类型	
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //提要
            isTemplateError = TiYaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //密级	
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //页数
            isTemplateError = PageCountPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //责任者
            isTemplateError = ResponsibleUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档人
            isTemplateError = FileUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //保管期限
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //著录人
            isTemplateError = RecordUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档单位
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //文件编号
            isTemplateError = DocumentNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //份数
            isTemplateError = CopiesPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //主题词
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //备注
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //获奖级别
            isTemplateError = AwardTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        /// <summary>
        /// 文书卷内件
        /// </summary>
        private bool WSOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            //临时序号
            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //档号
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities, true);
            //题名
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            //起日期
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //止日期
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //文件日期
            isTemplateError = RecordTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档日期
            isTemplateError = FileTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //载体类型	
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //提要
            isTemplateError = TiYaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //密级	
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //页数
            isTemplateError = PageCountPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //责任者
            isTemplateError = ResponsibleUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档人
            isTemplateError = FileUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //保管期限
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //著录人
            isTemplateError = RecordUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档单位
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //文件编号
            isTemplateError = DocumentNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //份数
            isTemplateError = CopiesPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //主题词
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //备注
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //获奖级别
            isTemplateError = AwardTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        /// <summary>
        /// 综合卷
        /// </summary>
        private bool ZHArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            //临时序号
            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //档号
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            //题名
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            //起日期
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //止日期
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //文件日期
            isTemplateError = RecordTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档日期
            isTemplateError = FileTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //载体类型	
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //提要
            isTemplateError = TiYaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //密级	
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //页数
            isTemplateError = PageCountPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //责任者
            isTemplateError = ResponsibleUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档人
            isTemplateError = FileUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //保管期限
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //著录人
            isTemplateError = RecordUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档单位
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //文件编号
            isTemplateError = DocumentNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //份数
            isTemplateError = CopiesPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //主题词
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //备注
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //获奖级别
            isTemplateError = AwardTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        /// <summary>
        /// 综合卷内件
        /// </summary>
        private bool ZHOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            //临时序号
            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //档号
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities, true);
            //题名
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            //起日期
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //止日期
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //文件日期
            isTemplateError = RecordTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档日期
            isTemplateError = FileTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //载体类型	
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //提要
            isTemplateError = TiYaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //密级	
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //页数
            isTemplateError = PageCountPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //责任者
            isTemplateError = ResponsibleUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档人
            isTemplateError = FileUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //保管期限
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            //著录人
            isTemplateError = RecordUserPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //归档单位
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //文件编号
            isTemplateError = DocumentNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //份数
            isTemplateError = CopiesPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //主题词
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //备注
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            //获奖级别
            isTemplateError = AwardTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }
        #endregion

        private bool ExcelCellReadErrorProcess(Cell cell, Color errorColor)
        {
            cell.Style.ForegroundColor = errorColor;
            cell.Style.Pattern = BackgroundType.Solid;
            return true;
        }

        #region"件"

        //文书(件)
        private bool WSPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = DoplicateBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = FileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }

            return isTemplateError;
        }

        //声像(件)
        private bool SXPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }

            return isTemplateError;
        }

        //光盘(件)
        private bool GPPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            startColumnIndex++;//TODO型号
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }

            return isTemplateError;
        }

        //荣誉(件)
        private bool RYPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = GloryTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            if (!isTemplateError)
            {
                entities.Add(entity);
            }

            return isTemplateError;
        }

        //设备(件)
        private bool SBPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            startColumnIndex++;//TODO数量
            isTemplateError = TypeNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //科研(件)
        private bool KYPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = FileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //勘探（单井）(件)
        private bool KTDJPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = WellNumberPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = WellAddressPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = DoplicateBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = WellTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = FileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            //新增字段
            isTemplateError = CatagoryTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }

            return isTemplateError;
        }

        //勘探（综合）(件)
        private bool KTZHPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = FileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }

            return isTemplateError;
        }

        #endregion

        #region"Read卷内件"

        //设备(卷内件)
        private bool SBOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.F_ArchiveId = relateEntityId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumForPageFilePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = TypeNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //科研(卷内件)
        private bool KYOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;
            entity.F_ArchiveId = relateEntityId;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumForPageFilePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = DocumentNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //勘探（单井）(卷内件)
        private bool KZDJOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;
            entity.F_ArchiveId = relateEntityId;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = WellNumberPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = WellAddressPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = DoplicateBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = WellTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //勘探（综合）(卷内件)
        private bool KTZHOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;
            entity.F_ArchiveId = relateEntityId;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageNumForPageFilePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = FileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }

            return isTemplateError;
        }

        //会计账簿(卷内件)
        private bool KJZBOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;
            entity.F_ArchiveId = relateEntityId;

            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = K_YearPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumForPageFilePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //会计其他(卷内件)
        private bool KJQTOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;
            entity.F_ArchiveId = relateEntityId;

            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = K_YearPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumForPageFilePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //会计凭证(卷内件)
        private bool KJPZOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;
            entity.F_ArchiveId = relateEntityId;

            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = K_YearPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumForPageFilePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //财务报告(卷内件)
        private bool CWBGOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;
            entity.F_ArchiveId = relateEntityId;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = K_YearPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumForPageFilePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //基建(卷内件)
        private bool BuildOwnerPageFileRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;
            entity.F_ArchiveId = relateEntityId;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = PublishTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = PublisherPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumForPageFilePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = DocumentNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        #endregion

        #region"Read卷"

        //财务报告(卷)
        private bool CWBGArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = K_YearPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageFileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //会计凭证(卷)
        private bool KJPZArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = K_YearPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageFileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StartAccountPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = EndAccountPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = AccountTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //会计其他(卷)
        private bool KJQTArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = K_YearPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageFileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //会计账簿(卷)
        private bool KJZBArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = K_YearPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageFileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //勘探（单井）(卷)
        private bool KTDJArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = WellNumberPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = WellAddressPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = DoplicateBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //勘探（综合）(卷)
        private bool KTZHArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //科研(卷)
        private bool KYArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublishOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageFileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = AchiveLevelPrppertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);
            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //设备(卷)
        private bool SBArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublishOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = FileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TypeNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }

        //基建(卷)
        private bool BuildArchiveRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublishOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageFileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }


        //Author:Yidane
        //Date:2014年4月22日00:36:38
        /// <summary>
        /// 文书卷
        /// </summary>
        /// <param name="cells"></param>
        /// <param name="rowIndex"></param>
        /// <param name="startColumnIndex"></param>
        /// <param name="entities"></param>
        /// <param name="dataId"></param>
        /// <param name="archiveType"></param>
        /// <param name="isTemplateError"></param>
        /// <param name="codeTable"></param>
        /// <returns></returns>
        private bool DOCUMENT_ARCHIVE_VOLRead(Cells cells, int rowIndex, int startColumnIndex, List<CommonEntityDTO> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable)
        {
            CommonEntityDTO entity = new CommonEntityDTO();
            entity.DataId = dataId;
            entity.ArchiveType = archiveType;

            isTemplateError = TempOrderPropertyNumRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = TitlePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = StartTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = EndTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PublishOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = SecretTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepSecretTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, true);
            isTemplateError = CarrierTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = KeepTimePropertyRead(cells, rowIndex, startColumnIndex++, entity, codeTable, isTemplateError, false);
            isTemplateError = FileOrgIdPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = PageFileNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, false);
            isTemplateError = MainBodyNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = HuJianHaoPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = RemarkPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = SummaryPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = StorageTypePropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true);
            isTemplateError = ArchiveNumPropertyRead(cells, rowIndex, startColumnIndex++, entity, isTemplateError, true, entities);

            if (!isTemplateError)
            {
                entities.Add(entity);
            }
            return isTemplateError;
        }
        #endregion

        #region"PreportyRead"

        //临时序号
        private bool TempOrderPropertyNumRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                entity.TempOrderNum = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //文件编号
        private bool DocNumPropertyNumRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                entity.DocNum = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //题名
        private bool TitlePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                entity.Title = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //保管期限
        private bool KeepTimePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, CodeTable codeTable, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                foreach (Dict dict in codeTable.KeepTimes)
                {
                    if (dict.Value == cell.StringValue)
                    {
                        entity.F_KeepTime = dict.Key.ToString();
                        break;
                    }
                }
                if (string.IsNullOrEmpty(entity.F_KeepTime))
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //载体类型
        private bool CarrierTypePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, CodeTable codeTable, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                foreach (Dict dict in codeTable.CarrierTypes)
                {
                    if (dict.Value == cell.StringValue)
                    {
                        entity.F_CarrierType = dict.Key.ToString();
                        break;
                    }
                }
                if (string.IsNullOrEmpty(entity.F_CarrierType))
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //密级
        private bool SecretTypePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, CodeTable codeTable, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                foreach (Dict dict in codeTable.SecretTypes)
                {
                    if (dict.Value == cell.StringValue)
                    {
                        entity.F_SecurityType = dict.Key.ToString();
                        break;
                    }
                }
                if (string.IsNullOrEmpty(entity.F_SecurityType))
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //保密期限
        private bool KeepSecretTimePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, CodeTable codeTable, bool isTemplateError, bool isCanbeNull)
        {
            if (codeTable.KeepSecurityTimes.Count == 0)
            {
                return isTemplateError;
            }
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                foreach (Dict dict in codeTable.KeepSecurityTimes)
                {
                    if (dict.Value == cell.StringValue)
                    {
                        entity.F_KeepSecurityTime = dict.Key.ToString();
                        break;
                    }
                }
                if (string.IsNullOrEmpty(entity.F_KeepSecurityTime))
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //凭证类别
        private bool AccountTypePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, CodeTable codeTable, bool isTemplateError, bool isCanbeNull)
        {
            if (codeTable.AccountTypes.Count == 0)
            {
                return isTemplateError;
            }
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                foreach (Dict dict in codeTable.AccountTypes)
                {
                    if (dict.Value == cell.StringValue)
                    {
                        entity.AccountType = dict.Key.ToString();
                        break;
                    }
                }
                if (string.IsNullOrEmpty(entity.AccountType))
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //归档单位
        private bool FileOrgIdPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.FileOrgId = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //档案部门名称
        private bool ArchiveOrgIdPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.ArchiveOrgID = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //提要
        private bool SummaryPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.Summary = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //提要
        private bool TiYaoPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.TiYao = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //存放位置
        private bool StorageTypePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.StorageType = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //正本数量
        private bool MainBodyNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.MainBodyNum = cell.IntValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //副本数量
        private bool DoplicateBodyNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.DoplicateBodyNum = cell.IntValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //文档编号
        private bool FileNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.FileNum = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //盒号
        private bool BoxNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.BoxNum = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //扩展信息
        private bool ExpansionInfoPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.ExpansionInfo = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //责任者
        private bool PublisherPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.Publisher = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //发布单位
        private bool PublishOrgIdPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.PublishOrgId = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //文件日期
        private bool PublishTimePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.PublishTime = DateTime.Parse(cell.Value.ToString());
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //卷页数
        private bool PageNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.PageNum = cell.IntValue.ToString();
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //卷内件页数 
        private bool PageNumForPageFilePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.PageNum = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //件数
        private bool PageFileNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.PageFileNum = cell.IntValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //页数
        private bool PageCountPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.PageCou = cell.IntValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //互见号
        private bool HuJianHaoPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.HuJianHao = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //备注
        private bool RemarkPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.Remark = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //荣誉类型
        private bool GloryTypePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.GloryType = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //井号
        private bool WellNumberPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.WellNumber = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //地区名
        private bool WellAddressPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.WellAddress = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //井别
        private bool WellTypePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.WellType = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //日期
        private bool ArchiveDatePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.ArchiveDate = cell.DateTimeValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //起日期
        private bool StartTimePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.StartTime = cell.DateTimeValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //止日期
        private bool EndTimePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.EndTime = cell.DateTimeValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //年度
        private bool K_YearPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.K_Year = cell.IntValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //起凭证号
        private bool StartAccountPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.StartAccount = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //止凭证号
        private bool EndAccountPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.EndAccount = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //凭证类别
        private bool AccountTypePropertyRead_1(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.AccountType = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //数量
        private bool OrderNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.OrderNum = cell.IntValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //获奖级别
        private bool AchiveLevelPrppertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.AchiveLevel = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //归档日期(EquipmentArchive)
        private bool FileTimePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.FileTime = cell.DateTimeValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //文件编号（科研类，基建特有）
        private bool DocumentNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.DocumentNum = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //型号(装备类特有)
        private bool TypeNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.TypeNum = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //档号
        private bool ArchiveNumPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull, List<CommonEntityDTO> entities, bool canRepeat = false)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                if (!canRepeat)
                    foreach (CommonEntityDTO item in entities)
                    {
                        if (item.ArchiveNum == cell.StringValue)
                        {
                            isTemplateError = ExcelCellReadErrorProcess(cell, Color.Red);
                            return isTemplateError;
                        }
                    }
                entity.ArchiveNum = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //文件日期
        private bool RecordTimePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.RecordTime = cell.DateTimeValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //责任者
        private bool ResponsibleUserPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.ResponsibleUser = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //归档人
        private bool FileUserPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.Fileuser = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //著录人
        private bool RecordUserPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.RecordUser = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //份数
        private bool CopiesPropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null)
            {
                try
                {
                    entity.Copies = cell.IntValue;
                }
                catch (Exception)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //获奖级别
        private bool AwardTypePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, bool isTemplateError, bool isCanbeNull)
        {
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                entity.AwardType = cell.StringValue;
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }

        //凭证类别
        private bool CatagoryTypePropertyRead(Cells cells, int rowIndex, int columnIndex, CommonEntityDTO entity, CodeTable codeTable, bool isTemplateError, bool isCanbeNull)
        {
            if (codeTable.AccountTypes.Count == 0)
            {
                return isTemplateError;
            }
            Cell cell = null;
            cell = cells[rowIndex, columnIndex];
            if (cell.Value != null && !string.IsNullOrEmpty(cell.StringValue))
            {
                foreach (Dict dict in codeTable.CatagoryType)
                {
                    if (dict.Value == cell.StringValue)
                    {
                        entity.CatagoryType = dict.Key.ToString();
                        break;
                    }
                }
                if (string.IsNullOrEmpty(entity.CatagoryType))
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            else
            {
                if (!isCanbeNull)
                {
                    isTemplateError = ExcelCellReadErrorProcess(cell, Color.Blue);
                }
            }
            return isTemplateError;
        }
        #endregion
    }

    public delegate bool MetaDataRead<T>(Cells cells, int rowIndex, List<T> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable);

    public delegate bool ManagePageFileMetaDataRead<T>(Cells cells, int rowIndex, List<T> entities, string dataId, string relateEntityId, int archiveType, bool isTemplateError, CodeTable codeTable);

    public delegate bool UnManagePageFileMetaDataRead<T>(Cells cells, int rowIndex, List<T> entities, string dataId, int archiveType, bool isTemplateError, CodeTable codeTable);

    public delegate bool FilePathRead<T>(Cells cells, int rowIndex, bool isTemplateError, string tempEntityId, Dictionary<string, string> entityIdRelateAttachFilePathDict, string type);
}
